package com.west.imclient.parser;

import java.net.Socket;

import com.west.imclient.handler.IHandler;
import com.west.imclient.handler.impl.ChatHandler;
import com.west.imclient.handler.impl.SynHandler;
import com.west.imclient.handler.impl.ShakeHandler;
import com.west.imclient.view.MeetingRoomView;

import imserverentity.entity.Protocol;


public class Parser {
	public static IHandler parse(Protocol protocol, MeetingRoomView meetingRoomView) {
		switch (protocol.getMsgType()) {
		case "syn":
			return new SynHandler(protocol.getParams(), meetingRoomView);
		case "logout":
			return new ShakeHandler(protocol.getParams(), meetingRoomView);
		case "chat":
			return new ChatHandler(protocol.getParams(), meetingRoomView);
		case "shake":
			return new ShakeHandler(protocol.getParams(), meetingRoomView);
		default:
			return null;
		}
	}
}
